#include<bits/stdc++.h>
using namespace std;
#define int long long

bool is[100005];

signed main() {

	memset(is, 1, sizeof is);
	is[1] = 0;
	for (int i = 2; i <= 100001; i++) {
		if (is[i]) {
			for (int j = 2 * i; j <= 100001; j += i)
				is[j] = 0;
		}
	}

	int t;
	cin >> t;
	while (t--) {
		int x;
		cin >> x;
		int ans = 0;
		for (int i = 5; i <= x; i += 2) {
			if (is[i] && is[i - 2])
				ans++;
		}
		cout << ans << endl;
	}
	return 0;
}
